import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../views/Home/'
import Cart from '../views/Cart/'
import Search from '../views/Search/'
import Friends from '../views/Friends/'
import NewsList from '../views/Home/news/NewsList'
import NewsInfo from '../views/Home/news/NewsInfo'
import PhotosList from '../views/Home/photos/PhotosList'
import PhotosInfo from '../views/Home/photos/PhotoInfo'
import GoodsList from '../views/Home/goods/GoodsList'
import GoodsInfo from '../views/Home/goods/GoodsInfo'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    redirect: '/home'
  },
  {
    path: '/home',
    component: Home,
    meta: {
      title: '首页'
    }
  },
  {
    path: '/home/newslist',
    component: NewsList,
    meta: {
      title: '新闻列表'
    }
  },
  {
    path: '/home/newsinfo/:newsID',
    component: NewsInfo,
    meta: {
      title: '新闻详情'
    },
    props: true
  },
  {
    path: '/home/photolist',
    component: PhotosList,
    meta: {
      title: '图片列表'
    }
  },
  {
    path: '/home/photoinfo/:id',
    component: PhotosInfo,
    meta: {
      title: '图片详情'
    },
    props: true
  },
  {
    path: '/home/goodslist',
    component: GoodsList,
    meta: {
      title: '商品列表'
    }
  },
  {
    path: '/home/goodsinfo',
    component: GoodsInfo,
    meta: {
      title: '商品详情'
    }
  },
  {
    path: '/search',
    component: Search,
    meta: {
      title: '搜索'
    }
  },
  {
    path: '/friends',
    component: Friends,
    meta: {
      title: '好友'
    }
  },
  {
    path: '/cart',
    component: Cart,
    meta: {
      title: '购物车'
    }
  }

]

const router = new VueRouter({
  routes
})

export default router
